<admintpl file="header" />
<style>
.search_bar{background-color:#d9edf7;border-radius:4px;color:#3a87ad;display:block;min-height:30px;border-color:#bce8f1;padding:8px 35px 8px 14px;}.search_where{border-bottom:1px solid;border-radius:5px;border-right:1px solid;display:inline-block;width:30%;min-width:300px;margin:0 5px 5px;padding:5px;}.w150{width:150px;}
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">列表</a></li>
			<li><a href="{:U($action['add'])}" target="_self">新增</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U($action['index'])}">
			<?php foreach ($where_list as $k => $where_listv) : ?>
				<div class="search_where">
				<?php if(is_array($where_listv)) : ?>
					<?php echo $where_listv['lang']; ?>： 
				<?php else: ?>
					<?php echo $where_listv; ?>： 
				<?php endif; ?>
				
				<?php if($where_listv['show_type'] == 'select') : ?>
					<select class="select_2" name='where[<?php echo $k; ?>]'>
						<option value="">-不限-</option>
						<?php foreach ($where_listv['data'] as $select_value => $select_title) : ?>
							<option value="<?php echo $select_value; ?>" <?php if(isset($where[$k]) && $where[$k] == $select_value) : ?>selected<?php endif; ?>><?php echo $select_title; ?></option>
						<?php endforeach; ?>
					</select>
				<?php elseif ( $where_listv['show_type'] == 'checkbox') : ?>
						<?php foreach ($where_listv['data'] as $checkbox_value => $checkbox_title) : ?>
							<label class="checkbox inline"><input type="checkbox" name="where[<?php echo $k; ?>][]" value="<?php echo $checkbox_value; ?>" <?php if(isset($where[$k]) && $where[$k] == $checkbox_value): ?>checked='checked'<?php endif; ?>><?php echo $checkbox_title; ?></label>
						<?php endforeach; ?>	
				<?php elseif ( $where_listv['show_type'] == 'radio') : ?>
						<label class="radio inline"><input type="radio" name="where[<?php echo $k; ?>]" value="" <?php if(!isset($where[$k])): ?>checked='checked'<?php endif; ?> >不限</label>
						<?php foreach ($where_listv['data'] as $radio_value => $radio_title) : ?>
							<label class="radio inline"><input type="radio" name="where[<?php echo $k; ?>]" value="<?php echo $radio_value; ?>" <?php if(isset($where[$k]) && $where[$k] == $radio_value): ?>checked='checked'<?php endif; ?>><?php echo $radio_title; ?></label>
						<?php endforeach; ?>
				<?php elseif ($where_listv['show_type'] == 'datetime') :?>
					<input type="text" name="where[<?php echo $k; ?>][start]" value="<?php echo isset($where[$k]['start']) ? $where[$k]['start'] : date('Y-m-d', strtotime('- 1 days')); ?>" class="js-date" style="width: 80px;" autocomplete="off" title="<?php echo $where_listv['unit'] ?  $where_listv['unit'] : '';?>">
					- <input type="text" name="where[<?php echo $k; ?>][end]" value="<?php echo isset($where[$k]['end']) ? $where[$k]['end'] : date('Y-m-d'); ?>" class="js-date" style="width: 80px;" autocomplete="off" title="<?php echo $where_listv['unit'] ?  $where_listv['unit'] : '';?>">
				<?php else: ?>
					<input type="text" name="where[<?php echo $k; ?>]" value="<?php echo $where[$k]; ?>"  placeholder="请输入<?php if(is_array($where_listv)) : ?><?php echo $where_listv['lang']; ?><?php else: ?><?php echo $where_listv; ?><?php endif; ?>..." title="<?php echo $where_listv['unit'] ?  $where_listv['unit'] : '';?>"/>
				<?php endif; ?>
				</div>
			<?php endforeach; ?>
			<input type="submit" class="btn btn-primary" value="搜索" />
		</form>
		<form class="js-ajax-form" action="" method="post">
		
			<div class="table-actions">
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action['listorders'])}">{:L('SORT')}</button>
				<?php foreach ($buttonlist as $but => $but_name) :?>
					<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action[$but],array($but=>1))}" data-subcheck="true"><?php echo $but_name;?></button>
					<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action[$but],array('un'.$but=>1))}" data-subcheck="true">取消<?php echo $but_name;?></button>
				<?php endforeach;?>
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action['delete'])}" data-subcheck="true" data-msg="你确定删除吗？">{:L('DELETE')}</button>
			</div>
			
			
			
			<table class="table table-bordered table-hover definewidth m10 ckeckTable">
				<thead>
					<tr>
					
						<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th width="50">{:L('SORT')}</th>
						
						<?php foreach ($lang as $k => $langv) :?>
							<th><?php echo is_array($langv) ? $langv['lang'] : $langv;?></th>
						<?php endforeach;?>
					</tr>
				</thead>
				<?php foreach ($volist as $item) :?>
					<tr>
					
						<td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="{$pk}[]" value="{$item[$pk]}" title="ID:{$item[$pk]}"></td>
						<td><input name="listorders[{$item[$pk]}]" class="input input-order" type="text" size="5" value="{$item.listorder}" title="ID:{$item[$pk]}"></td>
					
					
						<?php foreach ($lang as $k => $langv) :?>
							<td><?php echo $item[$k];?></td>
						<?php endforeach;?>
					</tr>
				<?php endforeach;?>
			</table>
		    
			<div class="table-actions">
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action['listorders'])}">{:L('SORT')}</button>
				<?php foreach ($buttonlist as $but => $but_name) :?>
					<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action[$but],array($but=>1))}" data-subcheck="true"><?php echo $but_name;?></button>
					<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action[$but],array('un'.$but=>1))}" data-subcheck="true">取消<?php echo $but_name;?></button>
				<?php endforeach;?>
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U($action['delete'])}" data-subcheck="true" data-msg="你确定删除吗？">{:L('DELETE')}</button>
			</div>
			
			<div class="pagination">{$Page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		function refersh_window() {
			var refersh_time = getCookie('refersh_time');
			if (refersh_time == 1) {
				window.location = "{:U($action['index'],$formget)}";
			}
		}
		setInterval(function() {
			refersh_window();
		}, 2000);
		$(function() {
			setCookie("refersh_time", 0);
			Wind.use('ajaxForm', 'artDialog', 'iframeTools', function() {
				//批量移动
				$('.js-articles-move').click(function(e) {
					var str = 0;
					var id = tag = '';
					$("input[name='ids[]']").each(function() {
						if ($(this).attr('checked')) {
							str = 1;
							id += tag + $(this).val();
							tag = ',';
						}
					});
					if (str == 0) {
						art.dialog.through({
							id : 'error',
							icon : 'error',
							content : '您没有勾选信息，无法进行操作！',
							cancelVal : '关闭',
							cancel : true
						});
						return false;
					}
					var $this = $(this);
				});
			});
		});
	</script>
</body>
</html>